package com.liu.api.pojo;

import com.alibaba.fastjson.JSONObject;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * @author liubo
 */
public class Users implements Serializable {
    private String userId;
    private String userName;

    private String createDate;
    private String createUser;
    private String modifyDate;
    private String modifyUser;
    private String state;

    public void init(JSONObject json) {

        ThreadLocal<Integer> threadLocal = new ThreadLocal();

        threadLocal.set(1);


        this.setUserId(json.getString("USER_ID"));
        this.setUserName(json.getString("USER_NAME"));

        this.setCreateDate(json.getString("CREATE_DATE"));
        this.setCreateUser(json.getString("CREATE_USER"));
        this.setModifyDate(json.getString("MODIFY_DATE"));
        this.setModifyUser(json.getString("MODIFY_USER"));
        this.setState(json.getString("STATE"));
    }

    public void init(Map map) {
        JSONObject json = new JSONObject();
        json.putAll(map);
        this.init(json);
    }

    public JSONObject toJson() {
        JSONObject json = new JSONObject();
        json.put("USERS_ID", this.getUserId());
        json.put("USER_NAME", this.getUserName());

        json.put("CREATE_DATE", this.getCreateDate());
        json.put("CREATE_USER", this.getCreateUser());
        json.put("MODIFY_DATE", this.getModifyDate());
        json.put("MODIFY_USER", this.getModifyUser());
        json.put("STATE", this.getState());
        return json;
    }

    public Map toMap() {
        Map map = new HashMap();
        JSONObject json = this.toJson();
        map.putAll(json);
        return map;
    }

    @Override
    public String toString() {
        return this.toJson().toString();
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getCreateDate() {
        return createDate;
    }

    public void setCreateDate(String createDate) {
        this.createDate = createDate;
    }

    public String getCreateUser() {
        return createUser;
    }

    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }

    public String getModifyDate() {
        return modifyDate;
    }

    public void setModifyDate(String modifyDate) {
        this.modifyDate = modifyDate;
    }

    public String getModifyUser() {
        return modifyUser;
    }

    public void setModifyUser(String modifyUser) {
        this.modifyUser = modifyUser;
    }
}
